Implementing user-accessible pull-down menus with Juggernaut. This file will help explain some of the concepts of pull-down menus. The sysop's menu system uses these same methods. This document and the attached files will be an example, later it can be the basis for your own pull-down menus. OVERVIEW Because these menu's are complex, tricky, and can require lots of ANSI's, it's best to implement them as a MENU SUB SYSTEM. Which merely uses the "MENU _path" command. We put all our related ANSI's into the directory, then call the menu sub subsystem. To exit, we just call our primary menu system. example: MENU _c:\bbs\doormenu to call our door-menu sub system MENU _c:\bbs to return to our primary menu system Thus, two commands: GDOR: MENU _c:\bbs\doormenu >d99 RSYS: MENU _c:\bbs >001 On the main menu, we set up an option (such as "Play Door Games") that executes "GDOR" to go to the DOORMENU menu subsystem. In the menu sub system, we set up options (such as "Quit to Main Menu") that executes "RSYS" to return back to the main menu (primary menu system). Note that the "MENU" command merely changes menu systems, it's lost without the following ">xxx" order which tells it which menu of the new menu system we wish to display. Instead of ">xxx" any menu command can be used. In McEditor the top half is menus, and the bottom half is commands. "MENU" accesses those different menus, much like the "L" (load new menu system) command does in McEditor. The actual commands (bottom half of the screen) are common to all menu systems always. As for getting pull-down menus: that's actually fairly simple. We do menu command defining as normal. Up/down/left/right arrow keys are just the hot-keys "^_<>" ([Enter] = "~"). The last trick is specifying FX.TXT Special FX values that tells the software "hey this is a pull-down menu". The left-right movement across the screen is just different ansi's. IMPLEMENATION--MENU LEVEL Included here is the doormenu menu sub system. It's what I use for my on-line door games. It'll give you a good idea of how to implement a pull-down menu system. But the commands themselves won't work--since you didn't define the door commands/etc. As mentioned above, you need to have a GDOR and RSYS command to access this menu sub system. I've already pre-created both of these. The first thing that should be remembered is that DOORMENU is not one menu. It's six pull-down menus put into the same ANSI. I use left/right arrow key movement to change between these six menus (as a comparison, the "1ST" Style only has 5 menus). - Domination Other Sports Adventure Mail Are the basis options. It starts you out at "Domination". Hitting left arrow goes to "-", hitting right arrow goes to "Other". Each of these is really just a ">xxx" (goto a menu) commands. To get the pull-down menu effect at this stage, we have to create two ANSIs for each option: one with the above options and our current one highlighted, and one with the above options and our current one highlighted and the pull- down commands available to it. Example: hit [Enter] at "Domination". We then go to (">xxx") another menu that actually has (only) the "Domination menu's options" on it. - Domination Other Sports Adventure Mail ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Barren Realms Elite ³ ³ Food Fight ³ ³ Gang Warfare ³ ³ Gang Warfare Maps ³ ³ Mechwars ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ To summarize so far: From the main menu, we execute "GDOR" which calls up the DOORMENU menu sub system and goes to menu d99 (">d99") which displays the ANSI DOORS99.ANS. This DOORS99 displays the "command line". In the d99 menu, we defined [Enter] to go to menu d20, which displays the ANSI DOORS12.ANS. This DOORS12 displays the above list of available games. So far, it's nothing really complex, just a lot of trickery with ANSI's and goto menu commands. Just TYPE (DOS) all the .ANS's and you'll see the trickery. We can do this trickery because the time it takes to redraw one line of ANSI codes is barely noticable--particularly if it was a line already on the screen. Where complexity comes in, however, is with multiple menus and multiple keystrokes. For instance, I didn't just define that arrow keys move you left/right, but also "4" and "6" (keypad). Further I defined that "D" brings up the Domination menu, that "Q" or "-" quits, etc. This is why starting off with DOORMENU as a basis for another pull-down menu system is so useful, with all the menu jumping around, one can get lost. Let me re-stress this. At each menu, I've got a lot of extra commands that do exactly the same thing. This is to allow the user maximum flexibility. They can choose how they want to move about. Go into McEditor and do an "L" then "C:\BBS\DOORMENU" and it'll bring up this DOORMENU menu sub system. You'll see menu after menu of nothing but ">xxx" orders, with a few RSYS's, and later on a very few other commands. IMPLEMENATION--PULL-DOWN COMMANDS It's these other commands that we now turn to. They are the pull-down commands. Remember that we're dealing with six separate menus, and lots of ">xxx" orders to link them up. Because we want fancy left-right action, it's actually 12 menus but lets not dwell on that. But pull-down menus only concern a single menu, for example Menu d20 which is our Domination pull-down menu. This menu contains lots of ">xxx" commands and: RSYS, DM15, DM06, DM10, DM17, DM08, DM20 Only these last commands matter. They actually do something. RSYS, as mentioned before, merely exit's us back to the main menu. DM15, DM06, DM10, DM17, DM08, DM20 are the door-calling commands. More importantly for us, they are each pull-down commands. What does it mean to be a pull-down command? It means that the user may use the up/down arrow keys to move up and down the screen to each command. Un-highlighting the old one, and highlighting the new one. The moving up/down and highlighting is handled by the software. The Hot-Key field is not used, however I like to give them values ("ABCDEF...") according to their top-down position so that the user can just jump to them without using the arrow keys (or if the first/key letter for each is different, just use that for the hot-key). It's just an alternative that makes life easier for the user. The real secret of pull-downs is the Special FX, Row, Column and Text For FX fields. Look at the FX.TXT (or FX_TXT.DOC). The "sss" special effect field doesn't allow numbers, because when it does have numbers, the software uses that to mean "it's to be part of a pull-down menu". Those numbers are the colors we want to use. Nothing more. The coordinates and the text to use are in the other fields (the same fields we use for "normal" special effects). The "sss" breaks down as follows: 1st char: 0 or 1 to designate normal colors or bright colors. 2nd char: 0 to 7 to designate the foreground (text) colors. 3rd char: 0 to 7 to designate the background colors. These colors are the colors on the menu ANSI. Their only purpose is to tell the software what colors to redraw the text string after you move off that enter to another entry. The colors used by the selection cursor are defined with "_FXBAR=sss" at the bottom of the FX.TXT file. Where "sss" corresponds to the same color codes above. The Row/Column fields tell the software where the effects (in this case pull-down menu simulation) is to occur for each command. The software sorts your commands by Row and will go up/down to the previous/next command according to this sorting--you can't have two or more commands with the same Row. The Text For FX field this contains the text to display. Both when we highlight and turn-off. Ideally it should match what the ANSI displayed. The software goes through these fields, and uses the longest one to define how long it's "highlight bar" should be for all the commands. You can mix and match pull-down commands and non-pull-down commands on the same menu. Only those commands with SpecialFX > 99 are used for the up/down positioning and length of hightlight bar calculation. That's it. All the other complexity with this DOORMENU example is to provide the across-the-top action (left/right arrow key stuff). The +/- keys are automatically drafted as hot-keys to duplicate the up/down arrow commands. For those comm program users without arrow key support. Of course, you cannot use either the up/down arrows or +/- as menu command hot-keys on pull-down menus. NOTES Menu d99 is actually a "first time" menu. It gives the user instructions, but is otherwise identical to Menu d02. I use "eans" before most doors. This display's the ANSI which says "Exiting to door...".